<?php 

class Debugger {

	public function __construct(){
		error_reporting(E_ALL | E_STRICT);
	}

	public function error_handler($errno, $errstr, $errfile, $errline, $errcontext){
		$backtrace = array_reverse(debug_backtrace());
		array_pop($backtrace);
		echo "<div>";
		foreach($backtrace as $trace){

			$args = implode(', ',$trace['args']);
			$args = trim($args, ',');
			
			$trace['class'] = '';
			if($trace['class'] != ''){
				$trace['class'] .= '->';
			}
			
			echo "<div><strong>$trace[file]:$trace[line]</strong></div>\r\n";
			echo "<div><em>$trace[class]$trace[function]($args)</em></div><br/>\r\n";
		}
		echo "</div>";
		
		echo "<div>$errstr</div>";
		die;
	}
}



?>